// 统一管理专业相关请求接口方法
// 引入自己封装的axios方法
import request from "@/utils/request";
import type { majorAllResponseData, majorInfoData, majorListFormData, majorListResponseData, majorResponseData } from "./type";
// 请求地址枚举
// @ts-ignore
enum API{
    MAJOR_ALL_URL="/manage/major/all",
    MAJOR_LIST_URL="/manage/major/list",
    MAJOR_ADD_URL="/manage/major/add",
    MAJOR_GET_ID_URL="/manage/major/find",
    MAJOR_UPDATE_URL="/manage/major/update",
    MAJOR_DELETE_URL="/manage/major/delete",
}
// 获取所有专业
export const reqMajorAll =()=>request.get<any,majorAllResponseData>(API.MAJOR_ALL_URL)
// 分页获取所有专业
export const reqMajorList =(data:majorListFormData)=>request.post<any,majorListResponseData>(API.MAJOR_LIST_URL,data)
// 添加专业
export const reqMajorAdd=(data:majorInfoData)=>request.post<any,majorResponseData>(API.MAJOR_ADD_URL,data)
// 查找所有专业信息（通过id）
export const reqMajorById =(_id:string)=>request.get<any,majorResponseData>(API.MAJOR_GET_ID_URL+`?_id=${_id}`)
// 修改专业信息
export const reqMajorUpdata =(data:majorInfoData)=>request.post<any,majorResponseData>(API.MAJOR_UPDATE_URL,data)
// 删除专业
export const reqMajorDelete =(majorId:string)=>request.post<any,majorResponseData>(API.MAJOR_DELETE_URL,{majorId})